UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UuQHkFcyD50pbyqIcBf0zc2TMgZgljyPyR1RGDUMYTQ='
WHERE
key_id = '51afb38e7d704622c83986427480aee28bb6acc77f7ab5c5289728641fe0b6b5'
AND (
token = 'UuQHkFcyD50pbyqIcBf0zc2TMgZgljyPyR1RGDUMYTQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)