UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uGBSzqGfjcGe5IAi6z1qkthGjFx09Uv7BEjvwpVWr7k=' 
WHERE 
  key_id = '8e5d4a8c6e72c3142b87046dc02a4dcd3c60c1a8f78cf228b963c194476d2177' 
  AND (
    token = 'uGBSzqGfjcGe5IAi6z1qkthGjFx09Uv7BEjvwpVWr7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035