UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZE8lJubR7OpPB9eucBSuoQoLH+Iz4PO5cVY7zaUw5U='
WHERE
key_id = 'c4e5c5581211e41aee00a3c1909f817adcece9cd19a4e14b5e937b4accc65af2'
AND (
token = 'qZE8lJubR7OpPB9eucBSuoQoLH+Iz4PO5cVY7zaUw5U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)