UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oWYClp+UPf30SEs4FVG4Vs3TEk+uOsET7PPA6sysz5Q='
WHERE
key_id = 'f43f609cd9397f86865ce4d9bad3810a50b3fe0c686266706766ee3f9cf2fd30'
AND (
token = 'oWYClp+UPf30SEs4FVG4Vs3TEk+uOsET7PPA6sysz5Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)