I started learning Spanish at 51 (three years ago). I spend a lot of time at it because I enjoy it. I am not sure of my exact level but some of my teachers have told me I am advanced. I had a new teacher today who told me that I have mastered the language (although that sounds like a bit too flattering to me because I still make plenty of grammatical errors and still often hesitate when speaking.)
I read a lot. I watch a lot of movies in my target language. I am fortunate to have a service with unlimited private lessons so I also get more than 10 hours of speaking practice a week.
What I have read is that adults are quite capable of learning languages. I think that is true as long as your short-term memory is still intact (which it should be at 40.)