Let R be a prime ring, let L be a noncentral Lie ideal of R and let g, h be two generalized derivations of R. In this paper, we characterize the structure of R and all possible forms of g and h such that (g(x(m))x(n) - x(s)h(x(t)), x(r)](k) = 0 for all x is an element of L, where m,n,s, t, r, k are fixed positive integers. With this, several known results can be either deduced or generalized. In particular, we give a Lie ideal version of the theorem obtained by Lee and Zhou in [An identity with generalized derivations, J. Algebra Appl. 8 (2009) 307-317] and describe a more complete version of the theorem recently obtained by Dhara and De Filippis in [Engel conditions of generalized derivations on left ideals and Lie ideals in prime rings, Comm. Algebra 48 (2020) 154-167].