On my GS3 the options for auto-locking range from "immediately" to "30 minutes". Suppose I wanted the auto-lock to happen only after 1 hour - is there any way to do this?
There are probably multiple solutions. The one coming to my mind again involves an app named Tasker, which is the most flexible automation app on Android. An idea would be to have it start a timer whenever the screen is switched off, which is "blanked" whenever the screen is turned on. Have the key guard turned off initially (i.e. no lock takes place), and turn it on when the timer's up (lock).
I've been trying out KeyGuard Tool++, which is supposed to perform this function. You can set it so that if you are within range of a particular WiFi SSID, the screen lock will not kick in. There are also options to look for specific BlueTooth devices or USB connections to determine whether the key guard kicks in.
However, it seems to not be quite reliable under Android KitKat on my HTC One (m8), so YMMV.
Update: After talking to the developer of KeyGuard Tool++, he is aware of the issue where the screen will not reliably stay unlocked if you have secured the device with a PIN code. He is already working on a fix and it will hopefully be released soon.