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 (
    32817, 32818, 32819, 32820, 32821, 32822, 
    32823, 32824, 32825, 32826, 32827, 
    32828, 32829, 32830, 32831, 32832, 
    32833, 32834, 32835, 32836, 32837, 
    32838, 32839, 32840, 32841, 32842, 
    32843, 32844, 32845, 32846, 32847, 
    32848
  ) 
  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.00086

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "76.81"
    },
    "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": 32,
        "rows_produced_per_join": 6,
        "filtered": "19.99",
        "index_condition": "(`portal`.`q_product_prices`.`product_id` in (32817,32818,32819,32820,32821,32822,32823,32824,32825,32826,32827,32828,32829,32830,32831,32832,32833,32834,32835,32836,32837,32838,32839,32840,32841,32842,32843,32844,32845,32846,32847,32848))",
        "cost_info": {
          "read_cost": "75.53",
          "eval_cost": "1.28",
          "prefix_cost": "76.81",
          "data_read_per_join": "153"
        },
        "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
32817 207.000000
32818 207.000000
32819 207.000000
32820 207.000000
32821 259.000000
32822 259.000000
32823 259.000000
32824 259.000000
32825 190.000000
32826 190.000000
32827 190.000000
32828 190.000000
32829 207.000000
32830 207.000000
32831 207.000000
32832 207.000000
32833 207.000000
32834 328.000000
32835 328.000000
32836 328.000000
32837 328.000000
32838 328.000000
32839 328.000000
32840 207.000000
32841 207.000000
32842 207.000000
32843 207.000000
32844 207.000000
32845 207.000000
32846 207.000000
32847 207.000000
32848 293.000000