UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iW/VrRh3zwu4rtGqJjAs6A08vj6ZY9HkHIS/PcDp6TU=' 
WHERE 
  key_id = '0463f31ff0bfb36462fd9bc9d72c29b302c9bbcd50964abe4bd7420770ea3844' 
  AND (
    token = 'iW/VrRh3zwu4rtGqJjAs6A08vj6ZY9HkHIS/PcDp6TU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032