Is there a quick way to disable a keyboard temporarily while cleaning it without unplugging it?
Solution 1:
In terms of Windows, you could theorectically go into device manager and uninstall the keyboard. Then do the cleaning, then right click device manager and select "scan for hardware changes" which should reinstall the keyboard driver.
I just tested on my workstation and it worked without an issue. You may have other results, but if it's Windows 10, it is probably safe.
I should note that my keyboard is a Microsoft wired keyboard, and the special buttons for volume and calculator all worked after doing this.
Solution 2:
For macOS, get KeyboardCleanTool (freeware)
Does what it says on the tin.
Mouse still works, so you can click to deactivate afterwards.