UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tfuEgrKm2CJE9Ycq376LvZxa8Q193BdNCysbNSF9xaw='
WHERE
key_id = '5f565784cada88aa150c6dfc5f4607f7dedf26e3d0e91708dd4453f9ff5a65cb'
AND (
token = 'tfuEgrKm2CJE9Ycq376LvZxa8Q193BdNCysbNSF9xaw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)