SELECT 
  cscart_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      cscart_products_categories.link_type = "M", 
      CONCAT(
        cscart_products_categories.category_id, 
        "M"
      ), 
      cscart_products_categories.category_id
    )
  ) AS category_ids, 
  product_position_source.position AS position 
FROM 
  cscart_products_categories 
  INNER JOIN cscart_categories ON cscart_categories.category_id = cscart_products_categories.category_id 
  AND cscart_categories.storefront_id IN (0, 1) 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
  LEFT JOIN cscart_products_categories AS product_position_source ON cscart_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 7184 
WHERE 
  cscart_products_categories.product_id IN (
    100512, 100513, 100514, 100515, 100516, 
    100517, 100518, 100519, 100520, 100521, 
    100522, 100523, 100524, 100525, 100526, 
    100527, 100528, 100529, 100530, 100531, 
    100532, 100533, 100534, 100535, 100536, 
    100537, 100538, 100539, 100594, 100595, 
    100596, 100597, 100612, 100613, 100614, 
    100615, 100616, 100617, 100618, 100619, 
    100620, 100621, 100622, 100623, 100624, 
    100625, 100626, 100627
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00179

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "41.14"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 72,
            "rows_produced_per_join": 72,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "7.49",
              "eval_cost": "7.20",
              "prefix_cost": "14.69",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (100512,100513,100514,100515,100516,100517,100518,100519,100520,100521,100522,100523,100524,100525,100526,100527,100528,100529,100530,100531,100532,100533,100534,100535,100536,100537,100538,100539,100594,100595,100596,100597,100612,100613,100614,100615,100616,100617,100618,100619,100620,100621,100622,100623,100624,100625,100626,100627))"
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 3,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "18.00",
              "eval_cost": "0.36",
              "prefix_cost": "39.89",
              "data_read_per_join": "9K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "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",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 3,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.90",
              "eval_cost": "0.36",
              "prefix_cost": "41.15",
              "data_read_per_join": "57"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
100512 7337,7217M
100513 7337,7217M
100514 7337,7217M
100515 7337,7217M
100516 7337,7217M
100517 7337,7217M
100518 7337,7217M
100519 7337,7217M
100520 7337,7217M
100521 7337,7217M
100522 7337,7217M
100523 7337,7217M
100524 7337,7217M
100525 7337,7217M
100526 7337,7217M
100527 7337,7217M
100528 7337,7217M
100529 7337,7217M
100530 7337,7217M
100531 7337,7217M
100532 7337,7217M
100533 7337,7217M
100534 7337,7217M
100535 7337,7217M
100536 7186M
100537 7185M
100538 7186M
100539 7185M
100594 7186M
100595 7185M
100596 7186M
100597 7185M
100612 7185M
100613 7186M
100614 7186M
100615 7186M
100616 7185M
100617 7186M
100618 7185M
100619 7185M
100620 7186M
100621 7185M
100622 7185M
100623 7186M
100624 7185M
100625 7186M
100626 7185M
100627 7185M