How do I use 'security set-keychain-settings' to prevent locking?
If you run security set-keychain-settings without anything else it will turn off both "Lock when sleeping" and "Lock after  minutes of inactivity" for the 'login' Keychain. It will also set the default number of minutes back to 5.

From there you can turn on whatever settings you want.