UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D/fDbH1s+VIY1tAPFjiAGpCIxu9Yh2OdOqSz3/hS5fI=' 
WHERE 
  key_id = 'd45bad33b772138419755a6cbde92252720e47a3a02713355f1ac0d4cb65467e' 
  AND (
    token = 'D/fDbH1s+VIY1tAPFjiAGpCIxu9Yh2OdOqSz3/hS5fI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017