UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c4NhnpvEmRYvfrRjzUWSwTdzFggA6oJ4H0pwEKkviu4='
WHERE
key_id = '48bfd2127f847e990d369f473154f91546d4eb00b86a68344a0fd905debb14c5'
AND (
token = 'c4NhnpvEmRYvfrRjzUWSwTdzFggA6oJ4H0pwEKkviu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)