When to change road bike
25000 km isn't a lot. 

There isn't a time or mileage you should consider swapping out a frame. Instead, you should look for damage, such as dented tubes or cracks. You should be especially wary if you've been in an accident to check your bike out. Carbon fiber complicates this a bit, because its failure modes are generally more rapid than metal and harder to detect damage visually.

The mechanic might be trying to sell you something (most likely) or he might be right. You may want to get a second opinion from another mechanic.