UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PwKxYEaQC8VO6BNM5buYLJD2d7jqDjhdn30dvIcY47A='
WHERE
key_id = '46acc1cfa2057ce919bc4dced90875be9f5c73a4b84a0d6f819f25b413fb5852'
AND (
token = 'PwKxYEaQC8VO6BNM5buYLJD2d7jqDjhdn30dvIcY47A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)