UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KUTfMnMBFeQZzzipc0iT2jU57qgOIJb+eRDD1M7gKWc=' 
WHERE 
  key_id = '575261f0936be2bac4b5c08f3c59ac9da7b23e047ac192b3a3418b67eff52363' 
  AND (
    token = 'KUTfMnMBFeQZzzipc0iT2jU57qgOIJb+eRDD1M7gKWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032