The concepts of synchronous detection
To understand the background I will just touch the basice principler briefly before going to the minimalistic solution.
Basic principle
The basic principle of synchronous detection is that the detection or measurement is synchronized with the excitation of the medium we are trying to measure. The excitation is usually preformed at a set clock frequency and the measurement is locked on to the same clock. Lets use this specific reflected light detector task as an example.

Lockin amplifiers
These devices origins from the pre - digital age and aims to get an analog output signal. I dear to say that they are really just a generalized version of a synchronous detector. where the aim is to have a generic excitation driver / generator output. and a generic input. The excitation frequency tuning range of these devices can be quite wide and they have the advantage of not requiring the excitation frequency to be fitted inside the bandwidth of the ADC.

The minimal solution with a microcontroller

Arduino tasks
The mixer function
Syncronous exitation and demodulation
The Arduino ADC in free running mode
Continuous low pass filtering
Link to code repository:
https://github.com/Rune75/Arduino_Synchronous_Detector