UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'esJi6gm1JHG5Nm3KY/9yTxak6Nld8dhvsDOBsLrXu4I='
WHERE
key_id = 'f97c8d4d914623fde95041f87f043a9bb505a5ff99003c3a280917ae140b093f'
AND (
token = 'esJi6gm1JHG5Nm3KY/9yTxak6Nld8dhvsDOBsLrXu4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)