Efficiency of production lines is significantly impacted by maintenance activities, which are often overshadowed by the focus on production planning. The symbiotic relationship between maintenance and production activities is a critical yet overlooked factor. We examine the importance of maintenance planning, specifically within the dynamic context of production line operations. In this maintenance planning setting, scarce resources, particularly technicians, are commonly disregarded. Our research addresses the challenge of real-time maintenance planning across multiple production lines by developing a state-of-the-art heuristic, which takes into account machine production states and resource availability and is augmented by re-enactment procedures. We validate the heuristic by employing Markov Decision Processes and digital twin Discrete Event Simulations, which leverage real-world production data. This modeling framework is new for this specific problem. In our experiments, we compare the heuristic against optimal policies and practitioner-based policies. Our heuristic matches the performance of optimal policies in the Markov Decision Processes and significantly outperforms FCFS and practitioner-based policies in the Discrete Event Simulations. Notably, our heuristic is not only effective against standard policies, realizing improvement of 1% to 3%, but it is also the first to be generally applicable to production lines involving multiple machines and resources in real-time.