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 (
    8764, 8765, 8766, 8767, 8768, 8769, 8770, 
    8771, 8772, 8773, 8774, 8776, 8788, 
    8825, 8826, 8827, 8828, 8829, 8830, 
    8831, 8832, 8833, 8834, 8835, 8841, 
    8843, 8844, 8845, 8846, 8847
  ) 
  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.00135

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 (8764,8765,8766,8767,8768,8769,8770,8771,8772,8773,8774,8776,8788,8825,8826,8827,8828,8829,8830,8831,8832,8833,8834,8835,8841,8843,8844,8845,8846,8847))",
        "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
8764 149.000000
8765 279.000000
8766 149.000000
8767 119.000000
8768 99.000000
8769 99.000000
8770 149.000000
8771 149.000000
8772 149.000000
8773 159.000000
8774 119.000000
8776 129.000000
8788 149.000000
8825 189.000000
8826 149.000000
8827 149.000000
8828 149.000000
8829 189.000000
8830 149.000000
8831 249.000000
8832 279.000000
8833 279.000000
8834 249.000000
8835 279.000000
8841 69.000000
8843 159.000000
8844 129.000000
8845 145.000000
8846 145.000000
8847 149.000000