Non-equilibrium longitudinal and transverse optical phonons in terahertz quantum cascade lasers