Aluminium will corrode somewhat, steel will rust and oxidization will creep up on it. so I don’t see why carbon is any different to how long it will last in its natural state. Its more prone to unnatural damage in regard to accidents though. I think a carbon frame that suffers a bad off would make me a bit more skeptical on its longevity over a steel frame
All that said though I have seen plenty of Titanium frames with cracks on the tubes and welds even though they may not have had any use more than what they were intended. I have also seen many alloy, steel and Ti frames with bad dents and dings from crashes etc.
Out of all the carbon components a frame would be the one I would have most faith in. I’m not too keen on bars and stems and seatposts made from it for MTB use. A frame would be the one thing I would buy though. I would buy one new though!