UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZSen4wzz22KZ+KxlbsUtiWYKiXDlQ/XyWl58zzrF1WI=' 
WHERE 
  key_id = 'c9c42352a6bcd35fd6c5adcc34b271b667f91e2aa59a10b6dc3ec8ef52ee94a4' 
  AND (
    token = 'ZSen4wzz22KZ+KxlbsUtiWYKiXDlQ/XyWl58zzrF1WI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022