This method allows you to set a precise timer for when your PC should lock without necessarily putting it to sleep.

Windows 11 can use your smartphone to lock your PC automatically when you walk away from your desk. How to Auto Lock Computer After Inactivity in Windows 11

Dynamic Lock automatically locks your computer when you walk away, using the Bluetooth signal from your smartphone. When your phone goes out of range, Windows waits 30 seconds and then locks the screen.

Set the time in minutes for when the lock should trigger.