I can't begin to think of which specific engine of which class.
However, generally speaking the USRA Light Mikados were reasonably well liked by the railroads that received them (with limited RRs turning up their nose at them including both PRR and WP, who greatly preferred their "own" design mikados). Many of the USRA light 2-8-2 engines had very long careers--even second careers. A number of Nickel Plate Road USRA (both light and heavy) mikes survived service in the U.S. and went south of the border to Mexico, serving well into the mid-1960's.
So some USRA light mikados exceeded 45 years of active mainline freight service, if you count Mexican service.
I have read a lot of books about steam locomotive history, and there were a number of relatively ahem "modern" steam engines constructed during the mid or late 1880's that lasted, perhaps for second and third owners and shortlines, very nearly to the end of steam. There are reports of steam engines achieving 60 years of service in some of these secondary applications. I was just reading the excellent "Southern Pacific's Ten Coupled Locomotives" last night, and the author stated and had pictures of some (at least one) engine that achieved nearly 60 years of service. Not all the service was for SP. It may have been a 4-8-0 Mastodon type.
This discussion could get complicated in a hurry when or if folks consider engines built as one type and significantly rebuilt and altered into something else, that then went on to serve for many years.
There also are instances, even on SP, of complete boiler swaps during the 1930's and 1940's, between 2-10-2's--It was noticed as a result of an engine that should have had an Alco boiler that instead had a Baldwin builder plate on it. The photo evidence is presented in the book cited above.
Santa Fe had 2-10-2's built in the early 1900's that lasted for many years, perhaps exceeding 50 years of service.
Finally, a number of late designs of steam power were so good that they would have been able to accumulate very long service lives, but the maintenance costs (driven by skyrocketing labor rates in the U.S.) cut those lives short.
For myself, I prefer to consider the "best" classes of steam, and what those designers really achieved, which was remarkable without cadd, than what had the opportunity to survive the longest.