40 is not a dinosaur. I'm 57 and have NO difficulty locating work. Fortunately (for me, not so much for employers). Employers have discovered that experience DOES count (and least those with more brains than a raven, those who don't... I don't want to work for anyway).
I also don't insist that I *deserve* every perc on the planet and that my work always be interesting.
Keep in mind, it's your work, not your life.