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 = 2913 
WHERE 
  cscart_products_categories.product_id IN (
    350511, 355422, 350579, 355405, 350381, 
    350420, 350306, 354322, 350347, 354323, 
    350342, 350368, 355618, 350283, 355620, 
    354738, 350435, 355619, 350504, 355446, 
    350226, 350335, 350442, 350448, 350468, 
    355421, 354526, 350345, 350456, 356842, 
    350385, 350513, 355389, 350282, 350519, 
    355408, 355412, 350417, 358345, 353702, 
    350337, 350412, 358351, 350362, 355406, 
    350462, 353716, 350583, 354523, 350375, 
    358343, 350352, 353726, 350361, 353701, 
    350268, 350377, 350410, 350411, 354743, 
    355429, 355425, 350346, 355418, 358333, 
    350313, 350373, 353712, 353723, 355415, 
    355417, 355438, 354524, 350379, 350380, 
    350388, 355396, 355409, 355439, 355420, 
    350382, 350403, 354525, 358348, 358349, 
    350378, 355395, 353105, 353813, 350589, 
    355411, 358350, 350393, 350311, 355390, 
    358353, 358347, 350384, 350310, 350421
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00233

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "281.15"
    },
    "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": 100,
            "rows_produced_per_join": 100,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "21.15",
              "eval_cost": "20.00",
              "prefix_cost": "41.15",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (350511,355422,350579,355405,350381,350420,350306,354322,350347,354323,350342,350368,355618,350283,355620,354738,350435,355619,350504,355446,350226,350335,350442,350448,350468,355421,354526,350345,350456,356842,350385,350513,355389,350282,350519,355408,355412,350417,358345,353702,350337,350412,358351,350362,355406,350462,353716,350583,354523,350375,358343,350352,353726,350361,353701,350268,350377,350410,350411,354743,355429,355425,350346,355418,358333,350313,350373,353712,353723,355415,355417,355438,354524,350379,350380,350388,355396,355409,355439,355420,350382,350403,354525,358348,358349,350378,355395,353105,353813,350589,355411,358350,350393,350311,355390,358353,358347,350384,350310,350421))"
          }
        },
        {
          "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",
              "webmarco.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 100,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "100.00",
              "eval_cost": "20.00",
              "prefix_cost": "161.15",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "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": [
              "webmarco.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 5,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "100.00",
              "eval_cost": "1.00",
              "prefix_cost": "281.15",
              "data_read_per_join": "29K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`webmarco`.`cscart_categories`.`storefront_id` in (0,1)) and ((`webmarco`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`webmarco`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`webmarco`.`cscart_categories`.`usergroup_ids`)) and (`webmarco`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
350226 2913M 0
350268 2913M 0
350282 2913M 0
350283 2913M 0
350306 2913M 0
350310 2913M 0
350311 2913M 0
350313 2913M 0
350335 2913M 0
350337 2913M 0
350342 2913M 0
350345 2913M 0
350346 2913M 0
350347 2913M 0
350352 2913M 0
350361 2913M 0
350362 2913M 0
350368 2913M 0
350373 2913M 0
350375 2913M 0
350377 2913M 0
350378 2913M 0
350379 2913M 0
350380 2913M 0
350381 2913M 0
350382 2913M 0
350384 2913M 0
350385 2913M 0
350388 2913M 0
350393 2913M 0
350403 2913M 0
350410 2913M 0
350411 2913M 0
350412 2913M 0
350417 2913M 0
350420 2913M 0
350421 2913M 0
350435 2913M 0
350442 2913M 0
350448 2913M 0
350456 2913M 0
350462 2913M 0
350468 2913M 0
350504 2913M 0
350511 2913M 0
350513 2913M 0
350519 2913M 0
350579 2913M 0
350583 2913M 0
350589 2913M 0
353105 2913M 0
353701 2913M 0
353702 2913M 0
353712 2913M 0
353716 2913M 0
353723 2913M 0
353726 2913M 0
353813 2913M 0
354322 2913M 0
354323 2913M 0
354523 2913M 0
354524 2913M 0
354525 2913M 0
354526 2913M 0
354738 2913M 0
354743 2913M 0
355389 2913M 0
355390 2913M 0
355395 2913M 0
355396 2913M 0
355405 2913M 0
355406 2913M 0
355408 2913M 0
355409 2913M 0
355411 2913M 0
355412 2913M 0
355415 2913M 0
355417 2913M 0
355418 2913M 0
355420 2913M 0
355421 2913M 0
355422 2913M 0
355425 2913M 0
355429 2913M 0
355438 2913M 0
355439 2913M 0
355446 2913M 0
355618 2913M 0
355619 2913M 0
355620 2913M 0
356842 2913M 0
358333 2913M 0
358343 2913M 0
358345 2913M 0
358347 2913M 0
358348 2913M 0
358349 2913M 0
358350 2913M 0
358351 2913M 0
358353 2913M 0