What model lock? Many locks have an autolock feature built-in, includings Schlage, August, and Yale. But those will then auto lock all the time, not just during a particular time.
Otherwise, if you are using the popular lock manager smartapp or @rboy’s smartapp for locks, I believe both have timed lock options. You might find those easier to set up and use then essentially starting from scratch with webcore, although certainly webcore can do it as well.
Have you used custom code before? Most people who get SmartThings only use IFTTT after that for integration with other systems. Any typical rules logic will probably have more features if you stay within the SmartThings platform.
If you haven’t used custom code before, the following FAQ describes the process, but it’s pretty straightforward. Basically you are going to copy the author’s code and paste it into your own account.
As for where to find the code that you will copy, usually the fastest way is to look in the quick browse lists in the community – created wiki. In this case you would look in the smart app section on the list for locks.
Or, of course, if you prefer, you can go straight to webcore. But I would take a look at the existing specialty smart apps for Locks first just to see if they have other features that you might like as well.