UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8LvckwzAUD6crWUpAi3HDv+F2CJTss+zLpMXkY4tAFc=' 
WHERE 
  key_id = 'b7a6411718478deed2c72bb8f4f92ffa20eb917c36165d246c10b2f0667d1f96' 
  AND (
    token = '8LvckwzAUD6crWUpAi3HDv+F2CJTss+zLpMXkY4tAFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00089