Depends on the airline Gregers
If you were 40 and female, it would be harder that being 40 and male, as aviation is still one of the most chauvinistic sexist, and ageist industries to be in, make no mistake!
However, many airlines employ older people, and are have anti discriminatroy workplace laws.....they would be most of the large american carries, Qantas, Britsih Airways, Air Canada, Lufhansa etc etc
The ones to be avoid obviously would be airlines such as EMirates, Virgin and those generally known for hiring dollybirds, or those who state their cut off age as being 35.
Good luck, you'll get there with determination!