UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dy8roElrtCKofxejcfC6UTGLu6BAFF7FVin+yiHmC0I='
WHERE
key_id = '14ba43210dfbfb7d03da1f4ff713d9638c6cb1074357228e70b1b6e527a4d65a'
AND (
token = 'dy8roElrtCKofxejcfC6UTGLu6BAFF7FVin+yiHmC0I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)