At least the OG 1701 got a good lifespan - it was no Miranda, but 40 years is great for an Enterprise.
The decommissioning of the A seemed a bit premature, though, considering it was a new ship that was relatively salvageable. Maybe its battle damage was just too much and that’s why it was given to the museum. Alternatively, the A was originally a different Constitution class undergoing a refit was was already quite old by Undiscovered country.
There’s a good chance the B lasted a long time too, though there’s no canon source to its demise, only that it’s not in the fleet museum.
According to Memory Alpha, 10 years because the ship was supposedly obsolete by then.