No offense personally intended, but as a mid-40s engineer/manager who knows many 40s/50s engineers, I can't relate to this sentiment. We have a couple of older engineers who are kinda useless, but we also have some useless young engineers too. Some of the older engineers dominate the engineering org, leading large architectures and more-often-than-not seeing technical issues very clearly and making good calls. Their defining characteristic is that they're good, not that they have gray hair.
My over-40 career advice for everyone is to stay sharp.