UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ba1Zt0nXkK+w3RkF5+xzJGdJEkC1ORtCgQ+Nf8a0jjc='
WHERE
key_id = 'c2b01ebbb31bc926744716188ef86d4d6224ca2ead97d60c526b6dcf2ae38033'
AND (
token = 'ba1Zt0nXkK+w3RkF5+xzJGdJEkC1ORtCgQ+Nf8a0jjc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)