UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aBy8RepVYRB4pUTJpKNHogfKXtPfA7YQxrKDgJQzfpg='
WHERE
key_id = '300f00947276268a21edc1b065e0a6e3683e9a0a0d82649ab8ff9dedd89d5c36'
AND (
token = 'aBy8RepVYRB4pUTJpKNHogfKXtPfA7YQxrKDgJQzfpg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)