UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pDMz2Rycg6Q9jloyAG6xQI2E4N8+p3gqDnnmEpx+Rak=' 
WHERE 
  key_id = '94a132f3da5c17170f70ac725cbb3d634a7a607dda213ab1347af502c1e38325' 
  AND (
    token = 'pDMz2Rycg6Q9jloyAG6xQI2E4N8+p3gqDnnmEpx+Rak=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041