In general, the initiation of preventive maintenance should be based on the technical state as well as the operating state of a production system. Since the operating state of a production system is often subject to fluctuations in time, the planning of preventive maintenance at preset points in time (e.g. age/block replacement) cannot be optimal. Therefore, we propose a so-called two-stage maintenance policy, which - in a first stage - uses the technical state of the production system to determine a finite interval [t, t + At] during which preventive maintenance must be carried out, and - in a second stage - uses the operating state of the production system to determine the optimal starting time t̂ for preventive maintenance within that interval. A generalized age maintenance policy optimizing both t and At is formulated in the first stage. To this end, the actual starting time of preventive maintenance is modelled in terms of a uniform distribution over the maintenance interval. Moreover, the expected costs of preventive maintenance are modelled as a decreasing function of the interval size. An efficient algorithm is developed to demonstrate the optimal strategy for a queue-like production system, via numerical results that offer useful insights.