You shouldn't let the car idle for minutes unattended. It's bad for the car and the environment. The engine needs to warm up briskly so as to get into its normal efficient combustion mode. When the engine is cold it will burn a richer mixture and the excess unburnt fuel will collect on your catalytic converter (and slowly poison it $$$!) as well as into the environment. Idling a cold engine is bad practice.
The high revs may be due to idle input from the O2 sensors to the computer trying to warm up the engine so the exhaust isn't so "dirty". As the engine warms, the exhaust clears up enough to allow the idle go back to "normal". But the exhaust from idling is always going to be dirty because the catalytic converter won't be hot enough to scrub the exhaust "clean".
If you read the BMW car manual it says to start the car and then just drive off at a moderate pace until the engine is at its normal temperature. Then you can press the engine harder if you want to.
Anyway, 40=B0F can't feel that cold. A lot of cars get stolen when owners leave them idling that way.