This paper introduces a maintenance optimization model designed for a system comprising two distinct components that are arranged in series and susceptible to common cause failure. Both the components undergo dependent degradation and shock processes whose performance levels are periodically inspected. A condition-based opportunistic maintenance policy is considered, indicating that either preventive or corrective maintenance may be conducted depending on the deterioration state observed during inspections. Meanwhile, when maintenance is performed on one component, the other can be opportunistically maintained. An optimization problem is then formulated under the framework of semi-Markov decision processes, in order to find the optimal preventive and opportunistic maintenance thresholds for the two components. Three algorithms are introduced to address this problem, namely the improved genetic algorithm, the cyclic coordinate search algorithm, and the enumeration algorithm. Their effectiveness is demonstrated through a case study focusing on offshore wind turbines. The result shows that the efficiency of the improved genetic algorithm is significantly superior to the other two algorithms.