UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8ZKGLs02C48ZScj5Hd1iHwFMf8M/rg/v1l/bjgCi0co='
WHERE
key_id = 'c1a089386639d70b43f11493cd530a7b9d30d19af9bed5b0565e1837bee57cd4'
AND (
token = '8ZKGLs02C48ZScj5Hd1iHwFMf8M/rg/v1l/bjgCi0co='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)