UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wRzMmqOeTbMiNBXziM85gxLhMhb2xrOzdzCTC9pVaQ8='
WHERE
key_id = 'e3191d72ca27c328185b7d2e905cc15c32e5448b44c9e75cc34d4fee75e110f7'
AND (
token = 'wRzMmqOeTbMiNBXziM85gxLhMhb2xrOzdzCTC9pVaQ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)