There is no fixed expiry date. What matters is whether your hardware meets a game's requirements, and that becomes harder over time as new releases raise the bar for the CPU, RAM, and especially the graphics card.
In practice, a gaming PC stays comfortable with new titles for roughly three to five years before it needs an upgrade. The most cost-effective single improvement is usually a new GPU. If you want a precise answer for your machine, look up its specifications against the requirements of the specific game you have in mind.