It doesn't make complete sense to me. If you're looking for an interpretation:
If deviceID like 0 then actionID else deviceID, then take the leftmost 9 characters of that expression and apply the Val function to it. Val will stop when it sees a character it cannot interpret as a number. Then coerce what is returned from that string (which looks like a number but must be a string) to a Long data type. Then update appreferrals.devicdID to that value.
The parts that don't make sense to me: LIKE operator is usually used with wildcards.
In your case I can't see how anything but '0' can be LIKE '0' but "012" is like "0*" or it is like "*0*"
Also, if the IIF function returns anything less than 9 characters, you will probably raise an error.
Not sure if this is desired or not, but if you expect this to only update 1 record, it will update every record where the expression evaluates to True because there is no criteria. So a lot of what's expected seems to rely on the existence of certain conditions. Kinda dangerous sometimes.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.