I guess the best advice for staying relevant is to find a niche that still has some future where you're an expert in your field. And get lucky, very lucky. There are a bunch of us in our late 40s / early 50s that were heavy BSD/Linux kernel contributors who are still relevant, even though we code in C like its 1995. I think this is similar to some folks from an older generation who wrote the COBOL that a lot of enterprises still run on.
BTW: Isn't the cutoff for greygler was 50? I seem to remember being too young to join when I was in my mid 40s.