SELECT 
  netting_banners.banner_id, 
  netting_banners.type, 
  netting_banners.target, 
  netting_banners.status, 
  netting_banners.timestamp, 
  netting_banner_descriptions.banner, 
  netting_banner_descriptions.description, 
  netting_banner_descriptions.url, 
  netting_banner_images.banner_image_id, 
  netting_banners.group_id 
FROM 
  netting_banners 
  LEFT JOIN netting_banner_descriptions ON netting_banner_descriptions.banner_id = netting_banners.banner_id 
  AND netting_banner_descriptions.lang_code = 'en' 
  LEFT JOIN netting_banner_images ON netting_banner_images.banner_id = netting_banners.banner_id 
  AND netting_banner_images.lang_code = 'en' 
WHERE 
  1 
  AND (
    netting_banners.type != 'G' 
    OR netting_banner_images.banner_image_id IS NOT NULL
  ) 
  AND netting_banners.banner_id IN (40) 
  AND netting_banners.status = 'A' 
  AND IF (
    netting_banners.type not like 'abt__ut2', 
    'available', 
    IF (
      netting_banners.type like 'abt__ut2' 
      AND (
        netting_banners.abt__ut2_use_avail_period = 'N' 
        OR (
          netting_banners.abt__ut2_use_avail_period = 'Y' 
          AND (
            netting_banners.abt__ut2_avail_from = 0 
            OR netting_banners.abt__ut2_avail_from <= 1743825519
          ) 
          AND (
            netting_banners.abt__ut2_avail_till = 0 
            OR netting_banners.abt__ut2_avail_till >= 1743825519
          )
        )
      ), 
      'available', 
      'not available'
    )
  ) = 'available' 
  AND (
    netting_banners.abt__ut2_usergroup_ids = '' 
    OR FIND_IN_SET(
      0, netting_banners.abt__ut2_usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, netting_banners.abt__ut2_usergroup_ids
    )
  ) 
ORDER BY 
  netting_banner_descriptions.banner asc

Query time 0.00039

JSON explain

{
  "query_block": {
    "select_id": 1,
    "const_condition": "1",
    "nested_loop": [
      {
        "table": {
          "table_name": "netting_banners",
          "access_type": "const",
          "possible_keys": ["PRIMARY", "status"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["banner_id"],
          "ref": ["const"],
          "rows": 1,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "netting_banner_descriptions",
          "access_type": "const",
          "possible_keys": ["PRIMARY"],
          "key": "PRIMARY",
          "key_length": "9",
          "used_key_parts": ["banner_id", "lang_code"],
          "ref": ["const", "const"],
          "rows": 1,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "netting_banner_images",
          "access_type": "const",
          "possible_keys": ["banner"],
          "key": "banner",
          "key_length": "9",
          "used_key_parts": ["banner_id", "lang_code"],
          "ref": ["const", "const"],
          "rows": 1,
          "filtered": 100
        }
      }
    ]
  }
}

Result

banner_id type target status timestamp banner description url banner_image_id group_id
40 G T A 1739336400 Lingua Linkup https://netting.com/lingualinkup/ 142 2