UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MZiBhsgGBtkljAoGMlqV3ckUL8GLCvSOqvfHZBfzrD4='
WHERE
key_id = '730694688dbbbfb252436a74287088fccbe3f009d30611d15a328216cc6b11ca'
AND (
token = 'MZiBhsgGBtkljAoGMlqV3ckUL8GLCvSOqvfHZBfzrD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)