Optimal two-phase opportunity-based age replacement policies in discrete time for sustainable systems