In my experience being under 40 is not a prerequisite for being hired in software. A suggestion: two of the biggest turnoffs that I personally see and would work hard to avoid (not saying you have either of those):
1. Sounding desperate. Do not cast a very wide net at one company -- you can apply to mid level and principal level positions at different companies, but do not blanket all job postings at one company. Choose one that fits you best and apply there.
2. Attitude. People with lots of experience often come in with "let me tell you how you should be doing this instead" approach which in most cases is a fatal wound. Learn what problems the company is solving and help them within their constraints, including using their tools and languages even if they look suboptimal.
Just as an anecdote, a friend (close to 50) working in software changed positions in Feb-March and had offers within 2 weeks. He chose to sit out at the dying unit to collect retention money; retention $ required not searching for jobs before he was officially let go, so he started his search from the "unemployed" state as well. It is certainly possible, good luck!