I'm not sure exactly how the S5's settings are laid out, but on my Nexus 5, in Settings>Security, there are settings for how long to wait while idle before the phone is locked ("Automatically Lock") and "Power Button Instantly Locks." It sounds like the latter is already turned on for you, but look for the other setting. I think it's called "Secure Lock Time" or something like that.