Second sgkent.
A restart is always better than a shut down. Shutdown preserves some stuff so power on is faster. However a restart does not preserve stuff previously in main memory. It's good hygiene to restart your computer, mobile phone, router etc. Now on the other hand if your computer is 20+ years old-- you may want to avoid and definitely have on a UPS as the disk drive may not spin back up after spinning at 10,000 RPMs for a long time. Most hard disk drives are rated for 500,000 or more MTBF, however that's a mean.
You could also try just pulling out the USB keyboard and mouse and just plug back in to see if that corrected the problem. It could have been the USB driver that lost its marbles.