Motivated by original equipment manufacturer (OEM) service and maintenance practices we consider a single component subject to replacements at failure instances and two types of preventive maintenance opportunities: scheduled, which occur due to periodic system reviews of the equipment, and unscheduled, which occur due to failures of other components in the system. Modelling the state of the component appropriately and incorporating a realistic cost structure for corrective maintenance as well as condition-based maintenance (CBM), we derive the optimal CBM policy. In particular, we show that the optimal long-run average cost policy for the model at hand is a control-limit policy, where the control limit depends on the time until the next scheduled opportunity. Furthermore, we explicitly calculate the long-run average cost for any given control-limit time dependent policy and compare various policies numerically.