UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tdT8ljIK8iwGdLfsznYOC8a6NRRiFQckDLgqNmrClBI='
WHERE
key_id = '81fd678923c9a549757d022e0a2e86129f971bee5cbc0abd1cac9414d784dfc0'
AND (
token = 'tdT8ljIK8iwGdLfsznYOC8a6NRRiFQckDLgqNmrClBI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)