Effects of finite temperature on two-photon transitions in a Rydberg atom in a high-Q cavity