Anda dapat mengubah subkueri Anda menjadi gabungan:
SELECT *
FROM application_log log
LEFT JOIN transaction transaction ON log.tag_value=transaction.id AND transaction.sale_id = 'xxx'
WHERE log.tag_value = 'xxx' OR transaction.id IS NOT NULL
ORDER BY log.log_date ASC;