The influence of anharmonic and magnetic interactions on lattice dynamics of α and β phases of solid oxygen