A master equation for a two-sided optical cavity