Phonon anomalies and magnetic excitations in BaFe2Se2O