Ppl are still gaming on 9 year old Sandy-Bridge cpus and 6 year old Ivy-Bridge cpus, although to be fair, it's mostly the top line i5/i7 with OC ability that are the survivors.
How long a cpu is viable depends on 2 things, software and you. I'm quite happy on my i7-3770K since it does the job I need it to do on the games I play. The day it stops doing so, because I quit those older games and start on newer, more demanding stuff is the day it becomes obsolete.
Some ppl insist on maximum ability, the gotta have it mentality. Must have latest games, must play at highest fps, must play at ultra settings. As software becomes more involved, the hardware needed to keep up also evolves, and becomes obsolete that much faster.
By itself, a cpu will easily last over 20+ years. Unfortunately the software makes it obsolete in a ¼ of that time.