Debo admitir que es desalentador tratar de desenredar esa consulta para comprender la lógica detrás de ella, pero creo que la siguiente consulta debería devolver los resultados que necesita.
{thistable}.id IN (
/*Finds booking slots where the booking slot does not overlap
with any of the existing bookings on that day,
or where the booking slot id is the same as the current slot.*/
SELECT t.id + 3
FROM fab_booking_slots AS t
WHERE t.id = '{fab_booking___book_starttime}'
OR NOT EXISTS (
Select 1
From fab_booking_taken AS p1
Where Date(p1.book_date) = Date('{fab_booking___book_bookingdate}')
And p1.book_end > t.heuredepart_resa
And p1.book_start < t.heurearrivee_resa
)
)
Order By id Asc;
Estoy bastante seguro de que esto es lógicamente equivalente, y una vez expresado en una forma simplificada como esta, es más fácil ver cómo puede hacer que también devuelva el intervalo de tiempo adicional.
Debe tener una consulta separada para usar al completar los intervalos de tiempo para una nueva reserva que no tiene un intervalo de tiempo existente, en cuyo caso puede eliminar la línea única t.id = '{fab_booking___book_starttime}' OR
.