That is terrible and is bound to feel like a total betrayal. I'm sorry this happened. It is also so new so it will take time to process
In terms of money and future, I wouldn't worry about it because if you choose to leave him - after 40 years and if you have children (long married and dependents) you are in a very strong position legally.
I'm not sure you will want to hear this particularly but tell you because it may help long term that I was an OW. I work in a world where it is very common for men to have affairs - and men to all intents and purposes who are in happy, long term marriages.
What I would say is men do compartmentalise in a weird way women don't understand. I'm not saying its good or right but it can be a different thing for a man. And honestly men do love their wives but choose to basically use another woman for sex. It may not help right now; but it is perfectly possible that this other woman means nothing to him and was just convenient.
The other thing is - and I've seen it everywhere through my work - that it is more common than you would ever think for men who seem to have long term (10 years +) happy and very stable marriage with children to be having affairs. It's almost like they think they can get away with and it won't matter. I've seen it so much that I've become very cynical and think a 100% faithful husband is like a unicorn and that generally women are very very naïve about the way men behave when they think they can get away with it.
Whatever happens, you can't make any decisions now or for a while until you've had a chance to process this information properly.
You don't say how old your children are - but I wouldn't say anything to any of them until you have taken stock. 40 years is a long time and if you choose to stay with him, this is something you may not want to ever share with your children.
Ignore those who immediately leap to the "leave the bastard" position. Only you can say if you can get past it or not with your husband and after 40 years, you may very well decide the level of love, affection, shared history and friendship outweighs anything else.