In the extreme case, assuming the dates on Memory Alpha are accurate, construction on the Enterprise NCC-1701-A was completed in 2287 (the date of the events of Star Trek V) and it was decommissioned in 2293 (after the events of Star Trek VI) for only a 6-year lifespan.
I have two potential headcanony explanations for that:
• The Enterprise-A was already commissioned as another ship prior to being the Enterprise-A, and it wasn't newly built as of 2287. I like the explanation in Mr Scott's Guide to the Enterprise that it was one of the "second generation" of Constitution-class ships, i.e. it didn't exist in a TOS configuration and it was built from scratch to meet or exceed the 1701's post-refit specs some time in the 2270s. This would explain why, for example, it has noticeably more advanced user interfaces on the bridge and a different model of warp core. Perhaps Starfleet used this "second generation" to test technologies that would be integrated into the Excelsior.
• With the original 1701 having been recently destroyed and the 1701-A still counting as "Kirk's Enterprise", Starfleet had the 1701-A declared of special historical significance on Kirk and crew's retirement even though on paper it still had many years of service left in it.
These aren't mutually exclusive. After all, if the Enterprise-A really were built in the mid- to late-2270s she's still less than 20 years old in The Undiscovered Country, and Constitution-class starships do seem to have remarkable longevity. Aside from the original 1701 herself notching up 40 years of service, there's the Potemkin NCC-1657, which appears onscreen in TOS: "The Ultimate Computer" and is listed on the "Operation Retrieve" plans in TUC, by which point she must be nearly 50 years old.