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 = 7156 
WHERE 
  cscart_products_categories.product_id IN (
    93772, 93773, 93774, 93775, 93776, 93777, 
    93778, 93779, 93780, 93825, 93826, 
    93827, 93828, 93829, 94073, 94140, 
    94141, 94142, 94143, 94144, 94145, 
    94146, 94147, 94148, 94149, 94150, 
    94151, 94152, 94153, 94154, 94155, 
    94156, 94157, 94158, 94159, 94160, 
    94452, 94453, 94454, 94455, 94456, 
    94458, 94459, 94460, 94461, 94462, 
    94604, 94605, 94606, 94607, 94608, 
    94609, 94610, 94611, 94612, 94613, 
    94614, 94615, 94616, 94617, 94618, 
    94654, 94655, 94656, 94657, 94658, 
    94666, 94667, 94668, 94669, 94670, 
    94751, 94752, 94753, 94754, 94755, 
    94756, 94757, 94758, 94762, 94764, 
    95314, 95378, 95379, 95380, 95381, 
    95382, 95383, 95384, 95385, 95386, 
    95387, 95388, 95389, 95390, 95391
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01671

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "129.93"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "6.07"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 208,
            "rows_produced_per_join": 8,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "20.72",
              "eval_cost": "0.83",
              "prefix_cost": "21.55",
              "data_read_per_join": "21K"
            },
            "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": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 117,
            "rows_produced_per_join": 6,
            "filtered": "0.62",
            "cost_info": {
              "read_cost": "2.33",
              "eval_cost": "0.61",
              "prefix_cost": "121.75",
              "data_read_per_join": "97"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (93772,93773,93774,93775,93776,93777,93778,93779,93780,93825,93826,93827,93828,93829,94073,94140,94141,94142,94143,94144,94145,94146,94147,94148,94149,94150,94151,94152,94153,94154,94155,94156,94157,94158,94159,94160,94452,94453,94454,94455,94456,94458,94459,94460,94461,94462,94604,94605,94606,94607,94608,94609,94610,94611,94612,94613,94614,94615,94616,94617,94618,94654,94655,94656,94657,94658,94666,94667,94668,94669,94670,94751,94752,94753,94754,94755,94756,94757,94758,94762,94764,95314,95378,95379,95380,95381,95382,95383,95384,95385,95386,95387,95388,95389,95390,95391))"
          }
        },
        {
          "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": 6,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.52",
              "eval_cost": "0.61",
              "prefix_cost": "123.87",
              "data_read_per_join": "97"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
93772 7194M
93773 7194M
93774 7194M
93775 7194M
93776 7194M
93777 7194M
93778 7194M
93779 7194M
93780 7194M
93825 7194M
93826 7194M
93827 7194M
93828 7194M
93829 7194M
94073 7194M
94140 7194M
94141 7194M
94142 7194M
94143 7194M
94144 7194M
94145 7194M
94146 7194M
94147 7194M
94148 7194M
94149 7194M
94150 7194M
94151 7194M
94152 7194M
94153 7194M
94154 7194M
94155 7194M
94156 7194M
94157 7194M
94158 7194M
94159 7194M
94160 7194M
94452 7157M,7341,7342,7343
94453 7157M,7341,7342,7343
94454 7157M,7341,7342,7343
94455 7157M,7341,7342,7343
94456 7157M,7341,7342,7343
94458 7157M,7341,7342,7343
94459 7157M,7341,7342,7343
94460 7157M,7341,7342,7343
94461 7157M,7341,7342,7343
94462 7157M,7341,7342,7343
94604 7194M
94605 7194M
94606 7194M
94607 7194M
94608 7194M
94609 7194M
94610 7194M
94611 7194M
94612 7194M
94613 7194M
94614 7194M
94615 7194M
94616 7194M
94617 7194M
94618 7194M
94654 7194M
94655 7194M
94656 7194M
94657 7194M
94658 7194M
94666 7194M
94667 7194M
94668 7194M
94669 7194M
94670 7194M
94751 7157M,7341,7342,7343
94752 7157M,7341,7342,7343
94753 7157M,7341,7342,7343
94754 7157M,7341,7342,7343
94755 7157M,7341,7342,7343
94756 7157M,7341,7342,7343
94757 7157M,7341,7342,7343
94758 7157M,7341,7342,7343
94762 7157M,7341,7342,7343
94764 7157M,7341,7342,7343
95314 7194M
95378 7194M
95379 7194M
95380 7194M
95381 7194M
95382 7194M
95383 7194M
95384 7194M
95385 7194M
95386 7194M
95387 7194M
95388 7194M
95389 7194M
95390 7194M
95391 7194M