This is quite difficult, as the exact answer depends on the geometry of the vessel and many other parameters.
In practice this kind of problems is often easier to solve experimentally.
Also, technically the answer is "it will never cool down to -40", as the temperature of the cooled down converges to the temperature of the surroundings, never getting there. It doesn't matter practically (you can always say everything below 39 is close enough), still it changes how the problem should be defined/question asked.
There are some approximate methods to estimate such time, but you would nee to find an engineer using them in practice, as far as I am aware none of the regulars works with this type of problems. I can be wrong though.