Today I had the problem again.
For now, I have a USB mouse and keyboard connected, and also a Bluetooth mouse that I keep turned off but with the receiver connected to a USB 3.0 HUB. So:
USB Mouse: ROCCAT KONE AIMO (RGB)
USB Keyboard: Trust GTX (RGB)
Bluetooth Mouse (on HUB-USB): Logitech MX MASTER
When the mouse and keyboard stopped working (even though they remained powered and lit), I tried turning on the Bluetooth mouse. The USB mouse came back online, and I turned off the Bluetooth one. However, the keyboard still didn't work, so I unplugged the USB cable and plugged it back in.
I think my problem is due to a Windows bug that switches between the various HID devices (4 for the keyboard and 3 for the mouse) automatically (for some reason).
So now I want to try uninstalling the other HIDs, hoping that they won't get reinstalled every time.
I trying this procedure:
https://www.lifewire.com/disable-laptop-keyboard-windows-10-4582462