Non-Markovian master equation for a damped oscillator with time-varying parameters