UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VdjWeJhF96wxmPTbG2LPReQ1egJQcEYNpg8JdknurBo=' 
WHERE 
  key_id = '6f8fa24656217679bc1c4fb8a1e2d683fae2461c44a3567f016cce02fc1c5434' 
  AND (
    token = 'VdjWeJhF96wxmPTbG2LPReQ1egJQcEYNpg8JdknurBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036