I'm almost 57 and still write real code that people use and employers make money from. The trick is to continuously learn new stuff. My whole career has always been spent at the leading edge of whatever was most important at the time. Sure, people sometimes don't want to interview you because they assume you are old and pointless, but that's usually when they don't even read your resume, blog, linked in or whatever you have. There are people who think that way, and there are people who recognize ability and experience matter. The trick is finding the latter while trying to avoid the former.
Some people don't learn anything new and become obsolete, or become management, or even have to start over away from programming. It's not easy to stay out front but you are the only one who can do it.