You are asking a general question to which the answer is "it depends". The answer is two-fold. First is the quality of the compressor. A commercial or military grade compressor is made for durability. The most recognizable brand in the world is Bauer, which is made in Germany and used by dive shops, fire departments, and public utilities where excessive failure rates are not tolerated. Walter Kidde is used in military applications such as military jets and tanks where routine failure is not acceptable . In a hobbyist application I doubt any commercial brand compressor will wear out from normal useage if it is maintained properly. The second part of the answer is maintenance. All compressors require the user to change filters, change lubricating oil, and keep the compressor serviced by replacing parts when they wear out. If you maintain your compressor, it will provide well in excess of 20 years of trouble free service.
What most guys don't understand is that you get what you pay for. Commercial compressors usually cost $3,000 and up when new. The newest hobby compressors being imported from China cannot be compared to a commercial duty compressor. Rubber compression rings will not wear like steel rings, and one owner may have his compressor last 20 years and another may fail in a year or less. A good analogy for compressors are airguns themselves. An Beeman R9 sold for $200 new 15 years ago and is now worth $350 used.. The Chinese clone of the HW95/R9 was a model B20 that was $100 new and might bring $50 if it still works. Anyone who thinks a 4500 psi compressor which wholesales to a U.S. importer for $800 will last 20 years is wishful thinking. Quality control, country of origin, and long
term availability of parts and service are just as important as the initial price of the compressor itself.