UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sLLa0fEdC3duoMiZDFKV6hkYMvE30Wr22f3KxMJZ+UQ='
WHERE
key_id = 'e54a47a7c239aa9965b54e9f42a4f9d804d2491988a5b28d8fb02360f70c21d7'
AND (
token = 'sLLa0fEdC3duoMiZDFKV6hkYMvE30Wr22f3KxMJZ+UQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)