Use a temporary key to avoid changing ttl

Make a temporary key, set the timeout on it, and then use renamenx to
rename this to the lock key.  This avoids modifying the expiry time on
an existing lock key, if there is one.  We need to clean up the
temporary key afterwards, in case there was an existing one.

Add a couple more tests to ensure that this is behaving as desired.