It might seem that if you don't take a crash course in machine learning and blockchain, that you'll be unemployable in a few years-- but in the past couple years I've personally seen dozens of business problems that could be solved by a decent programmer, and companies willing to pay for it, if only they had a way to connect. The problems just aren't where most people think the jobs are. Small manufacturing plants with funky regulatory requirements, construction companies, sausage factories. Not sexy, not glamorous. Just work that needs to be done.
I don't doubt that ageism is a thing, but depending on exactly how "aged" your particular skill set is, you might be more in-demand than you think. The last few jobs I've been involved with involving legacy hardware and software paid very well to the folks who still knew their way around 20+ year old systems.