SELECT 
  q_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      q_products_categories.link_type = "M", 
      CONCAT(
        q_products_categories.category_id, 
        "M"
      ), 
      q_products_categories.category_id
    )
  ) AS category_ids, 
  product_position_source.position AS position 
FROM 
  q_products_categories 
  INNER JOIN q_categories ON q_categories.category_id = q_products_categories.category_id 
  AND (
    q_categories.usergroup_ids = '' 
    OR FIND_IN_SET(0, q_categories.usergroup_ids) 
    OR FIND_IN_SET(1, q_categories.usergroup_ids)
  ) 
  AND q_categories.status IN ('A', 'H') 
  LEFT JOIN q_products_categories AS product_position_source ON q_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 249 
WHERE 
  q_products_categories.product_id IN (
    16250, 16253, 16257, 16259, 16260, 16263, 
    16266, 16267, 16268, 16269, 16270, 
    16271, 16274, 16275, 16295, 16296, 
    16299, 16300, 16302, 16303, 16304, 
    16305, 16306, 16310, 16311, 16312, 
    16313, 16314, 16315, 16316
  ) 
GROUP BY 
  q_products_categories.product_id

Query time 0.00093

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "147.81"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "q_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 31,
            "rows_produced_per_join": 31,
            "filtered": "100.00",
            "index_condition": "(`portal`.`q_products_categories`.`product_id` in (16250,16253,16257,16259,16260,16263,16266,16267,16268,16269,16270,16271,16274,16275,16295,16296,16299,16300,16302,16303,16304,16305,16306,16310,16311,16312,16313,16314,16315,16316))",
            "cost_info": {
              "read_cost": "67.21",
              "eval_cost": "6.20",
              "prefix_cost": "73.41",
              "data_read_per_join": "496"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "portal.q_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 31,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "31.00",
              "eval_cost": "6.20",
              "prefix_cost": "110.61",
              "data_read_per_join": "496"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "table": {
            "table_name": "q_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "portal.q_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 6,
            "filtered": "20.00",
            "cost_info": {
              "read_cost": "31.00",
              "eval_cost": "1.24",
              "prefix_cost": "147.81",
              "data_read_per_join": "16K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "(((`portal`.`q_categories`.`usergroup_ids` = '') or find_in_set(0,`portal`.`q_categories`.`usergroup_ids`) or find_in_set(1,`portal`.`q_categories`.`usergroup_ids`)) and (`portal`.`q_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
16250 255M
16253 496M
16257 255M
16259 255M
16260 583,436M
16263 255M
16266 255M
16267 255M
16268 255M
16269 255M
16270 436M
16271 579M
16274 255M
16275 255M
16295 255M
16296 436M
16299 436M
16300 255M
16302 255M
16303 255M
16304 255M
16305 255M
16306 255M
16310 496M
16311 489M
16312 252M
16313 252M
16314 252M
16315 252M
16316 252M