UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r9bvC5T/JKTAAMbhyp+SigStjFwhWuMd/ppA/YZBNEg=' 
WHERE 
  key_id = '88586051631b787953f1cb2e14d7334b9f3de959157037359c807776c7715b87' 
  AND (
    token = 'r9bvC5T/JKTAAMbhyp+SigStjFwhWuMd/ppA/YZBNEg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028