The cord on the 40 amp new stove fits the 50 amp receptacle, but I don't know if the power will be too great for the new stove.
Like stated in the comment, appliances only draw the current they need. So simply put, you're fine. It sounds like new stove uses less power than the old one.
Edit since I feel like I should explain better... The way it works, is a 50-amp receptacle has the ability to supply 50 amps of current. It is the device that controls how much it uses. Operating normally, your stove won't use more than 40 amps of current. Chances are it will normally use less than that.
50 amp receptacles on a 40A circuit are a very special case.
You are specifically allowed to use a 50A receptacle on a circuit whose in-wall wiring and circuit breaker are sized for 40A. This is an exception to the "receptacle must match breaker" rule, because 40A receptacles do not exist.
The breaker must still match the wire. So if the breaker is 50A the wire must be 6 AWG.
If you check the electrical code book you will see that the breaker needs to be sized to protect the appliance it is serving. So a 40 amp plug/appliance needs a 40 amp breaker. Your wiring is big enough, you just need to change your breaker to a 40 amp. As it is if something goes wrong with the appliance or cord and it draws to much power the breaker will not trip before the cord melts and starts on fire.