UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9f9jxuhm9MtECElET7nTRl5pZ+OE+34DKuOdk6idpl0=' 
WHERE 
  key_id = '91027a5e2ac5417a71819568632288f328e87c6f31309be26d65f5fbc6d9d7b5' 
  AND (
    token = '9f9jxuhm9MtECElET7nTRl5pZ+OE+34DKuOdk6idpl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030