UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O1vIugUlW+yrsemAqXFJsO6YJFldq+KyDptBwFUG/9k='
WHERE
key_id = '9972db4bec295c5831026b207b02ce1dc3f0f2f4b8ae10511ecbe80ca3ee2bc0'
AND (
token = 'O1vIugUlW+yrsemAqXFJsO6YJFldq+KyDptBwFUG/9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)