SELECT 
  q_product_prices.product_id, 
  MIN(
    IF(
      q_product_prices.percentage_discount = 0, 
      q_product_prices.price, 
      q_product_prices.price - (
        q_product_prices.price * q_product_prices.percentage_discount
      )/ 100
    )
  ) AS price 
FROM 
  q_product_prices 
WHERE 
  q_product_prices.product_id IN (
    393, 394, 395, 396, 397, 398, 399, 400, 
    401, 402, 403, 404, 405, 406, 407, 408, 
    409, 410, 411, 412, 413, 414, 415, 416, 
    417, 418, 419, 420, 421, 263
  ) 
  AND q_product_prices.lower_limit = 1 
  AND q_product_prices.usergroup_id IN (0, 1) 
GROUP BY 
  q_product_prices.product_id

Query time 0.00099

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "72.01"
    },
    "grouping_operation": {
      "using_filesort": false,
      "table": {
        "table_name": "q_product_prices",
        "access_type": "range",
        "possible_keys": [
          "usergroup",
          "product_id",
          "lower_limit",
          "usergroup_id"
        ],
        "key": "product_id",
        "used_key_parts": [
          "product_id"
        ],
        "key_length": "3",
        "rows_examined_per_scan": 30,
        "rows_produced_per_join": 5,
        "filtered": "19.99",
        "index_condition": "(`portal`.`q_product_prices`.`product_id` in (393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,263))",
        "cost_info": {
          "read_cost": "70.81",
          "eval_cost": "1.20",
          "prefix_cost": "72.01",
          "data_read_per_join": "143"
        },
        "used_columns": [
          "product_id",
          "price",
          "percentage_discount",
          "lower_limit",
          "usergroup_id"
        ],
        "attached_condition": "((`portal`.`q_product_prices`.`lower_limit` = 1) and (`portal`.`q_product_prices`.`usergroup_id` in (0,1)))"
      }
    }
  }
}

Result

product_id price
263 499.000000
393 179.000000
394 179.000000
395 275.000000
396 299.000000
397 365.000000
398 315.000000
399 199.000000
400 235.000000
401 465.000000
402 139.000000
403 139.000000
404 405.000000
405 405.000000
406 435.000000
407 245.000000
408 169.000000
409 299.000000
410 225.000000
411 329.000000
412 325.000000
413 45.000000
414 45.000000
415 45.000000
416 45.000000
417 109.000000
418 49.000000
419 49.000000
420 35.000000
421 35.000000