UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uTg9OtvG14VWA7+Vi3Fx/v3/DRPM/YJPdZE7V1ympgo=' 
WHERE 
  key_id = '4cd5c9bff829fe149c4adcb70e9c18864909a0dbfee6e1c83244509b69bc28a1' 
  AND (
    token = 'uTg9OtvG14VWA7+Vi3Fx/v3/DRPM/YJPdZE7V1ympgo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032