UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p+utBFemhR3hcs4f3jXTYLLApVBbw0Q4J3Q+VbMrghk='
WHERE
key_id = 'df08b4947ca84c985aa5be5b335304afdaa8ae5ac7304cf8889314404f9242bf'
AND (
token = 'p+utBFemhR3hcs4f3jXTYLLApVBbw0Q4J3Q+VbMrghk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)