How fast one can go in a sprint depends on the person and conditioning. That you hit 22 mph on a mountain bike suggests to me that you are not going to hit 40 mph on a road bike.
Road bikes accelerate faster then mountain bikes and you are more aerodynamic. I would think that if you can hit 22 mph on your mountain bike, you should be able to easily exceed 25 mph on a road bike. Now some people get really encouraged by the performance of the switch like from a mountain bike to a road bike (they get a bit discouraged by the difficulty of pushing a mountain bike to high speed). If you have that experience, you may even break 30 mph in a sprint.