UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NVjuA9scg+v1VRTm4EITfC5byURSsqye/YXX53NlEqw='
WHERE
key_id = '01c8d7168ac805b5cf292ce81490b249fb24209d24a6f0975576499fca1315ca'
AND (
token = 'NVjuA9scg+v1VRTm4EITfC5byURSsqye/YXX53NlEqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)