During REM sleep, your muscles go into a state called atonia. Essentially, all of your muscles except those in your eyes and those used for breathing are temporary paralyzed. You brain blocks signals that are normally sent to these muscles. This is true for humans and common among most other warm blooded mammals. This is the reason why your muscles don’t actually move when you’re dreaming about them moving. It’s a self preservation mechanism, preventing you from hurting yourself and other people while you’re asleep, which is obviously good for your safety but it also prevents you from waking yourself, ensuring a proper sleep. If your REM sleep is interrupted, your muscles resume from atonia and your mind returns to consciousness at roughly the same time. But, it is possible for your consciousness to resume before muscle control. You’ll be awake, but paralyzed. This is called “sleep paralysis” and as many as 60% of people will experience it at least once in their lifetime. It can be scary, but it normally occurs for a very brief period of time, sometimes it is so short that you may not even realize it happened.