Can I use a 12 V single channel optocoupler module in a 24 V machine?
You can safely use the module with 24V.

The input side shows a red LED, optocoupler and 1k resistor in series. The LED and optocoupler probably have a voltage drop in the neighbourhood of 3.1-3.5&nbsp;V put together, so for a 12&nbsp;V input you will get a current of approximately 9&nbsp;mA-.

For a 24 V input voltage the increased current will cause a slightly higher voltage drop, but even if the voltage drop remains as low as 3.1&nbsp;V the current will still only be 21&nbsp;mA. This is well within the rating of the optocoupler (similar optocouplers are often rated for 60&nbsp;mA) and slightly pushing the rating of the LED (similar LEDs are usually rated for 20&nbsp;mA) but it will probably be fine.

For extra peace of mind you could connect an additional resistor in series with the input. The "ideal" value (that is, to keep the current identical to that at 12&nbsp;V) would be 1.3&nbsp;kΩ, though any small value resistor (above 100&nbsp;Ω) would be fine.