The key is that you have to keep working on your skills to stay valuable for your (next) employer. When you're 40+ you can't compete with a 20 year old anymore when it comes to the ability to work crazy hours. But do you even want that?
As a senior you have a big advantage though, and that is your experience. But you have to make sure all the time that that experience is useful.
20 years experience is some dying language has very limited value. But 20 years of studying algorithms or general language concepts can get you almost anywhere. It helps of course if you like what you're doing, not everybody likes to study algorithms all the time. But there are plenty of other specialties around that will always be in demand.