I think a recent study showed 6 out of 11 panels or something maintained 80% of its original capacity after 30 years. As long as technological disruption does not deem replacement as a no brainer economically, I am sure quite a few panels may produce energy for 30 to 40 years.
As long as the inverter keeps working, you are right; you still get some (reduced) benefit for just letting them run.
At some point the inverter (a separate box, usually inside the house) will fail and need to be replaced. At that point you'd have to balance the price of a new inverter vs. the expected return of energy from the panels.