UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vun5qlBbOqYUUAEsuUE3jza0sG64neYxvpAEYjZIj3g='
WHERE
key_id = 'ebaddadd807ea0be16fd0d9721003cb41a174fc9489f2bab10e755e1acf059e8'
AND (
token = 'vun5qlBbOqYUUAEsuUE3jza0sG64neYxvpAEYjZIj3g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)