We derive the relation between the scattering phase shift and the two-particle energy in the finite box, which is relevant for extracting the strong phase shifts in lattice QCD. We consider elastic scattering of two particles with different mass and with non-zero total momentum in the lattice frame. This is a generalization of the Lüscher formula, which considers zero total momentum, and the generalization of Rummukainen-Gottlieb's formula, which considers degenerate particles with non-zero total momentum. We focus on the most relevant total momenta in practice, i.e. P = (2π/L) e z and P = (2π/L) (e x + e y ) including their multiples and permutations. We find that the P -wave phase shift can be reliably extracted from the two-particle energy if the phase shifts for l ≥ 2 can be neglected, and we present the corresponding relations. The reliable extraction of S-wave phase shift is much more challenging since δ l=0 is always accompanied by δ l=1 in the phase shift relations, and we propose strategies for estimating δ l=0 . We also propose the quark-antiquark and mesonmeson interpolators that transform according the considered irreducible representations.