One way to lock a Windows computer from your keyboard is by pressing Ctrl + Alt + Del and then selecting the "Lock" option.
If the Windows key is not working properly on your keyboard, there are several things you can do to troubleshoot it.