Unconscious might be overstating it, but there is a concept called "Time of Useful Consciousness" - which is basically the time frame where you are still able to function.
At 40,000 feet, time of useful consciousness is 15-20 seconds.
See https://expertaviator.com/2012/04/19/oxygen-requirements-tim...
Basically the partial pressure of oxygen is low enough at altitude that the oxygen is driven out of your blood instead of in.
There are some breathing techniques that can offset that somewhat, but only if you are prepared and trained, which is unlikely in a sudden decompression event.