Real life commercial ships are built with a hull life of 30 years, and warships with a hull life of 50. They might get another 10 years if rebuilt, but there isn't much which can be done to get too many more years out of a hull once it experiences enough material fatigue. In comparison, fighter jets can have a hull life in the 50,000 flight hour range, and might get extended another 10,000 flight hours near the end of their life. I'm not sure, but I think that works out to maybe 30 years before being sent back to the factory to be rebuilt, retired, or scrapped.
A huge exception is the B-52 which is expected to make it to the year 2040, and the last ones built are from 1962, for a life of just under 80 years.
Inertial dampeners and structural integrity fields might mitigate a lot of fatigue, and if Trek ships are built more like sea ships than aircraft, which seems to be the case given known Trek ships, then maybe, given a wild guess, we would see 200 year old hulls. Anything older is going to either be too worn out, or require so much rebuilding it would be cheaper to build a new ship. But, that's for an individual hull, not a class.
In real life the Burke class is around its 5th version, the M1 Abrams is getting a 4th and then 5th upgrade package ending on, I think, the M1A3 SEP 2, and the F-16 might be up to its 8th iteration. There is a limit to how much a platform can reasonably be upgraded, but upgrades can go on for decades and maintain reasonable combat effectiveness. In Trek this might result in a 50 year construction program for a single class, such as, I guess, with the Excelsior and Miranda, and for the final ship of a class making it through its hull life of 50 years, then being rebuilt for another 10 years of life. That low ends a class lasting 110 years assuming raw numbers of hulls are more important than staying up to date, and in the TNG period that seems to have been the case until the Dominion War, after which all the old ships disappear.
I realize my previous wild guess for hull life would make that 310 years for a single class.
Post Dominion War it seems unlikely we would see ancient hulls, except for ships returning from multi-decade, or multi-generational missions. A ship was dispatched to intercept Voyager, with an expectation of it taking, I think, 10 years, so missions like that exist.
P.S. - That might explain why Wesley is allowed to be an acting ensign, if there is already a system in place which the Enterprise-D had no use for, but which exists for other mission types.
P.P.S - That might also explain why a captain staying on one ship forever, thus blocking promotion for everyone beneath, is considered kosher. Unless that is merely an aberration of Picard and Kirk.