UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qXZgoO5hRQsZVSMbjZQX3hclYqMAkVhKM5kMFIl0Yw4='
WHERE
key_id = '82685b5fa21cb82eb97feeecd0490c7a36cd0dbd1fd0658aa88690dc50cb365f'
AND (
token = 'qXZgoO5hRQsZVSMbjZQX3hclYqMAkVhKM5kMFIl0Yw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)