UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v1U5o5hGZ2dZEelolU2mgJft8LpgiyASVNlIdN78udc='
WHERE
key_id = 'f9d5ca201c43e6cec7647879fa1f94bfae555587f63fdfa3d34659a069a32a28'
AND (
token = 'v1U5o5hGZ2dZEelolU2mgJft8LpgiyASVNlIdN78udc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)