UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8XxkpoRFzmO3BjFOcZ2pbSMA9MZN+HBySWQE7EyZVN4='
WHERE
key_id = '34cd0120cd961969ae3a0d3566786ffa9414d2f11b75f9d23997257cf742d880'
AND (
token = '8XxkpoRFzmO3BjFOcZ2pbSMA9MZN+HBySWQE7EyZVN4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)